package day0804;

import java.io.*;

/**
 * @author 杰哥不要啦~
 * @date 2021/8/4
 */
public class Test02 {
    public static void main(String[] args) throws IOException {
        File file = new File("E:\\123.txt");//创建文件对象
        boolean newFile = file.createNewFile();//创建文件返回是否创建成功
        System.out.println(newFile);
        FileOutputStream fos = new FileOutputStream("E:\\\\123.txt");
        String st = ("阿斯顿发生阿萨水电费");//创建字符串对象
        byte[] by = st.getBytes();//将字符串转化为字符赋值给by
        fos.write(by);
       // fos.write(Integer.parseInt("a"));
        FileReader fr = new FileReader("E:\\123.txt");
        FileWriter fw = new FileWriter("D:\\b.txt");
        int b ;
        char[] ca = new char[1024];
        while ((b = fr.read(ca)) != -1){
            fw.write(ca,0,b);
        }
        fos.close();
        fr.close();
        fw.close();
    }
}
